package com.ksp.wke.kspa04;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;

import static com.ksp.com.KSPCOM_BasConst.*;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantLock;

import javax.annotation.Resource;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.mockito.internal.configuration.MockAnnotationProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ksp.api.KSPAPI_UserAgentUtil;
import com.ksp.api.KSPAPI_UsrAuth;
import com.ksp.dom.KSPDOM_ResDta;

import net.minidev.json.JSONArray;

/**
 *	5.5.4KSPA04 文章明细查询
 * @author anye
 *
 */
@Controller
public class KSPA04Controller {
	
	@Autowired
	private KSPA04Mapper kspa04Mapper;

	@RequestMapping("/art/KSPA04")
	@ResponseBody
	public KSPDOM_ResDta iniPam(ServletRequest request, HttpServletResponse response) {
		String wTtlTch = request.getParameter("TTL_TCH");
		if (wTtlTch == null || "".equals(wTtlTch)) {
			return KSPDOM_ResDta.buildFail("文章信息异常");
		}
		
		Map<String, Object> wPamMap = new HashMap<>();
		wPamMap.put(TTL_TCH, wTtlTch);
		KSPDOM_ResDta wResDta = new KSPDOM_ResDta();
		try {
			wResDta = exeSrv(wPamMap);
		} catch (Exception e) {
			wResDta.setCod("400");
			wResDta.setMsg(e.getMessage());
		}
		
		return wResDta;
		
	}

	public KSPDOM_ResDta exeSrv(Map<String, Object> pPamMap) {
		List<Map<String, Object>> wQryPwdLst = kspa04Mapper.qryArtDetail(pPamMap);
		return KSPDOM_ResDta.buildSucc(JSONArray.toJSONString(wQryPwdLst));
	}
}
